package com.dman.multi.ui.comp;

public class Range {
	
	private long start;
	private long end;
	private long length;

	public Range(long start, long end, long length) throws InvalidRangeException {
		if(end < start || end - start < length)
			throw new InvalidRangeException();
		this.start = start;
		this.end = end;
		this.length = length;
	}

	public long getStart() {
		return start;
	}

	public long getEnd() {
		return end;
	}

	public void setEnd(long end) throws InvalidRangeException {
		if(end > this.end)
			throw new InvalidRangeException("Error setting end point");
		this.end = end;
	}

	public long getLength() {
		return length;
	}

	public void setLength(long length) throws InvalidRangeException {
		if(start + length > end)
			throw new InvalidRangeException("Error setting length");
		this.length = length;
	}
	
}
